home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / source / copperpicture.s < prev    next >
Text File  |  1993-12-18  |  40KB  |  2,026 lines

  1.  
  2. rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. routinemode    equ    1    ;the routinemode !
  11.  
  12.  
  13. ; the first part of the source handles the things that are necessary to
  14. ; show the picture/copper and playing of the routine.
  15. ; the part between the "***" lines is the routine-source.
  16. ; at the bottom of the file, there are the necessary incbin-files who
  17. ; are needed to test the routine.
  18. ; these are saved with "save effect" in videotracker. they are raw
  19. ; data files which can be fonts,pictures,landscapes,vectorobjects
  20. ; etcetra.
  21. ; the incbin-files are put in the "variables" table, in the routine-
  22. ; player-handler
  23. ; the place where it's done can be found by searching for "!!!"
  24.  
  25.  
  26.     opt    a+    ;devpac 3 optimize
  27.     opt    o+
  28.  
  29.     ifd    rout
  30.     ;videotracker routine-test
  31.  
  32.     incdir    "videotracker:include/"
  33.     include    "exec/types.i"
  34.     include    "graphics/gfxbase.i"
  35.     include    "lvo/graphics_lib.i"
  36.     incdir    'videotracker:effect/'
  37.  
  38. vew_wid    equ    44
  39. vew_hgt    equ    290
  40. win_hgt    equ    117
  41. win_str    equ    $1a
  42.  
  43.     SECTION    1,CODE_C
  44. tus
  45.     lea    var,a0
  46.     move.l    #rotsrc,curpic1        ;picture !!!
  47.     move.l    #rotset,var_cols1(a0)    ;colorset !!!
  48.  
  49.  
  50.     move.l    ($4).w,a6
  51.     sub.l    a1,a1
  52.     jsr    -$126(a6)        ;findtask
  53.     move.l    d0,curtsk
  54.     move.l    d0,a0
  55.     move.l    $b8(a0),tskpri
  56.  
  57.     lea    dosnam,a1        ;doslib openen
  58.     moveq.l    #0,d0
  59.     move.l    (4).w,a6
  60.     jsr    -408(a6)        ;openlib
  61.     move.l    d0,doslib
  62.  
  63.     bsr.s    label5            ;videotracker opstarten
  64.     
  65.     move.l    curtsk,a0
  66.     move.l    tskpri,$b8(a0)
  67.     move.l    ($4).w,a6
  68.     jsr    -$84(a6)        ;forbid
  69.  
  70.     move.l    doslib,a1
  71.     move.l    (4).w,a6
  72.     jsr    -414(a6)        ;closelib
  73.  
  74.     moveq.l    #0,d0
  75.     rts
  76.     
  77. label5
  78.     move.l    (4).w,a6        ;workbench gedoe
  79.  
  80.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  81.  
  82.     ifd    ntsctest
  83.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  84.     endc
  85.  
  86.     cmp.b    #50,ntscmode        ;ntsc ?
  87.     beq.s    str.ntsc
  88.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  89. str.ntsc
  90.  
  91.     lea    cprjmp,a2        ;copjmp zetten !
  92.     move.l    #cprbck-8,d0
  93.     move.w    d0,6(a2)
  94.     swap    d0
  95.     move.w    d0,2(a2)
  96.  
  97.     lea    cprbck-8,a2        ;copstr zetten !
  98.     move.l    #cpr,d0
  99.     move.w    d0,6(a2)
  100.     swap    d0
  101.     move.w    d0,2(a2)
  102.  
  103.     bsr    cprsprrem        ;sprites legen
  104.  
  105.     lea    gfxnam,a1        ;graphics lib openen
  106.     move.l    (4).w,a6
  107.     jsr    -408(a6)        ;openlib
  108.     move.l    d0,a6
  109.     move.l    d0,gfxlib
  110.     move.l    38(a6),oldcprlist
  111.  
  112.     bset    #1,$bfe001
  113.     bsr    copbuf            ;copper vullen
  114.  
  115.     bsr    sysoff
  116.  
  117. gadrun
  118.     btst    #6,($bfe001).l
  119.     bne    gadrun
  120.  
  121. scrend
  122. scrend.play
  123.     bsr    syson
  124.  
  125.     move.l    gfxlib,a1
  126.     move.l    (4).w,a6
  127.     jsr    -414(a6)        ;closelib
  128.  
  129. scrend.qb
  130.     moveq.l    #0,d0    
  131.     rts
  132.     
  133.     ;vertical blank interrupt, no blits.
  134.     ;handles counters,interlace,sprite
  135.     ;level 3
  136.  
  137. intvb
  138.     bra.s    intvb.cnt
  139.     dc.l    'VIDU'
  140.     dc.l    'LOOP'
  141. intvb.cnt
  142.     movem.l    d0-d7/a0-a6,-(sp)
  143.     lea    ($dff000).l,a6
  144.  
  145.     move.w    $01e(a6),d0
  146.     btst    #5,d0            ;vblank ?
  147.     bne.s    intvb.vb
  148.  
  149.     bra.s    intcop.end
  150.  
  151. intvb.vb
  152.     bsr    grap
  153.     bsr    palctr            ;palette zetten
  154.     bsr.s    copbuf            ;copper vullen
  155.     
  156. intvb.end
  157.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  158.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  159.     rte
  160.  
  161. intcop.end
  162.     movem.l    (sp)+,d0-d7/a0-a6
  163.     move.l    intvbold,-(sp)
  164.     rts
  165.  
  166.     ;transmission buffer empty routine, BLIT !
  167.     ;handles routines,animations
  168.     
  169. inttbe                    ;tbe interrupt
  170.     movem.l    d0-d7/a0-a6,-(sp)
  171.     lea    ($dff000).l,a6
  172.  
  173.     move.w    $01e(a6),d0
  174.     btst    #0,d0            ;no tbe ?
  175.     beq.s    intdskblk
  176.  
  177.  
  178.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  179.     beq.s    inttbe.cop
  180.     btst    #2,($dff016).l
  181.     beq.s    inttbe.cop
  182.  
  183.     ifd    debug
  184.     move.w    #$700,$dff180
  185.     endc
  186.     
  187.     bsr    rotply            ;routineplayer BLIT !
  188.     bsr.s    copbuf            ;copper vullen
  189.  
  190.     ifd    debug
  191.     move.w    #$070,$dff180
  192.     endc
  193.     
  194. inttbe.cop
  195.  
  196. inttbe.end
  197.     move.w    #$0001,$09c(a6)
  198.     movem.l    (sp)+,d0-d7/a0-a6
  199.     rte
  200.  
  201. intdskblk
  202.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  203.     movem.l    (sp)+,d0-d7/a0-a6
  204.     move.l    inttbeold,-(sp)
  205.     rts
  206.  
  207.  
  208.     ;moves the copperbuffer to the copperlist
  209.     ;sort of double buffering
  210.     
  211. copbuf
  212.     movem.l    d0-d7/a0-a6,-(sp)
  213.  
  214.     lea    ($dff000).l,a6
  215.  
  216. copbuf.novb                ;copperchange overslaan
  217.     moveq.l    #0,d0
  218.     move.b    $005(a6),d0
  219.     lsl.w    #8,d0
  220.     moveq.l    #0,d1
  221.     move.b    $006(a6),d1
  222.     add.w    d1,d0
  223.  
  224.     cmp.w    #$4,d0
  225.     blt    copbuf.novb
  226.  
  227.     cmp.b    #50,ntscmode
  228.     beq.s    copbuf.pal
  229.     cmp.w    #$133-56-8,d0        ;ntsc grens
  230.     bge    copbuf.novb
  231.     bra.s    copbuf.cont
  232. copbuf.pal
  233.     cmp.w    #$133-8,d0        ;pal grens
  234.     bge    copbuf.novb
  235. copbuf.cont
  236.  
  237.     lea    gra.s,a0        ;buffer copieren
  238.     lea    cprbuf,a1
  239.  
  240.     move.w    00*4+2(a0),00*4+2(a1)
  241.     move.w    01*4+2(a0),01*4+2(a1)
  242.     move.w    02*4+2(a0),02*4+2(a1)
  243.     move.w    03*4+2(a0),03*4+2(a1)
  244.     move.w    04*4+2(a0),04*4+2(a1)
  245.     move.w    05*4+2(a0),05*4+2(a1)
  246.     move.w    06*4+2(a0),06*4+2(a1)
  247.     move.w    07*4+2(a0),07*4+2(a1)
  248.     move.w    08*4+2(a0),08*4+2(a1)
  249.     move.w    09*4+2(a0),09*4+2(a1)
  250.  
  251.     move.w    10*4+2(a0),10*4+2(a1)
  252.     move.w    11*4+2(a0),11*4+2(a1)
  253.     move.w    12*4+2(a0),12*4+2(a1)
  254.     move.w    13*4+2(a0),13*4+2(a1)
  255.     move.w    14*4+2(a0),14*4+2(a1)
  256.     move.w    15*4+2(a0),15*4+2(a1)
  257.     move.w    16*4+2(a0),16*4+2(a1)
  258.     move.w    17*4+2(a0),17*4+2(a1)
  259.     move.w    18*4+2(a0),18*4+2(a1)
  260.     move.w    19*4+2(a0),19*4+2(a1)
  261.  
  262.     move.w    20*4+2(a0),20*4+2(a1)
  263.     move.w    21*4+2(a0),21*4+2(a1)
  264.     move.w    22*4+2(a0),22*4+2(a1)
  265.     move.w    23*4+2(a0),23*4+2(a1)
  266.     move.w    24*4+2(a0),24*4+2(a1)
  267.     move.w    25*4+2(a0),25*4+2(a1)
  268.     move.w    26*4+2(a0),26*4+2(a1)
  269.     move.w    27*4+2(a0),27*4+2(a1)
  270.     move.w    28*4+2(a0),28*4+2(a1)
  271.     move.w    29*4+2(a0),29*4+2(a1)
  272.  
  273.     move.w    30*4+2(a0),30*4+2(a1)
  274.     move.w    31*4+2(a0),31*4+2(a1)
  275.     move.w    32*4+2(a0),32*4+2(a1)
  276.     move.w    33*4+2(a0),33*4+2(a1)
  277.     move.w    34*4+2(a0),34*4+2(a1)
  278.     move.w    35*4+2(a0),35*4+2(a1)
  279.     move.w    36*4+2(a0),36*4+2(a1)
  280.     move.w    37*4+2(a0),37*4+2(a1)
  281.     move.w    38*4+2(a0),38*4+2(a1)
  282.     move.w    39*4+2(a0),39*4+2(a1)
  283.  
  284.     move.w    40*4+2(a0),40*4+2(a1)
  285.     move.w    41*4+2(a0),41*4+2(a1)
  286.     move.w    42*4+2(a0),42*4+2(a1)
  287.     move.w    43*4+2(a0),43*4+2(a1)
  288.     move.w    44*4+2(a0),44*4+2(a1)
  289.     move.w    45*4+2(a0),45*4+2(a1)
  290.     move.w    46*4+2(a0),46*4+2(a1)
  291.     move.w    47*4+2(a0),47*4+2(a1)
  292.     move.w    48*4+2(a0),48*4+2(a1)
  293.     move.w    49*4+2(a0),49*4+2(a1)
  294.  
  295.     move.w    50*4+2(a0),50*4+2(a1)
  296.     move.w    51*4+2(a0),51*4+2(a1)
  297.     move.w    52*4+2(a0),52*4+2(a1)
  298.     move.w    53*4+2(a0),53*4+2(a1)
  299.     move.w    54*4+2(a0),54*4+2(a1)
  300.  
  301. copbuf.end
  302.     movem.l    (sp)+,d0-d7/a0-a6
  303.     rts
  304.  
  305.     ;goes back to the workbench
  306.     
  307. syson
  308.     movem.l    d0-d7/a0-a6,-(sp)
  309.  
  310.     move.w    #$0001,$dff09a        ;tbeint uit
  311.     move.l    intvbold,($6c).w
  312.     move.l    inttbeold,($64).w
  313.  
  314.     move.l    4,a6
  315.     jsr    -138(a6)        ;permit
  316.  
  317.     move.l    gfxlib,a6
  318.     jsr    -462(a6)        ;disownblitter
  319.  
  320.     move.l    wbview,a1
  321.     move.l    gfxlib,a6
  322.     jsr    _LVOLoadView(a6)     ; Fix view
  323.     jsr    _LVOWaitTOF(a6)
  324.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  325.  
  326. syson.ras
  327.     cmp.b    #$c0,$dff006        ;prevent copperjump
  328.     bne    syson.ras
  329.  
  330.     move.l    gfxlib,a6
  331.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  332.  
  333.     movem.l    (sp)+,d0-d7/a0-a6
  334.     rts
  335.     
  336.     ;goes back to the gadgetscreen
  337.     
  338. sysoff
  339.     movem.l    d0-d7/a0-a6,-(sp)
  340.      
  341.     move.l    gfxlib,a6
  342.     move.l    gb_ActiView(a6),wbview    ;current view
  343.     sub.l    a1,a1            ; clear a1
  344.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  345.     jsr    _LVOWaitTOF(a6)     ; Wait once
  346.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  347.  
  348.     move.l    gfxlib,a6
  349.     jsr    -456(a6)        ;ownblitter
  350.  
  351.     move.l    4,a6
  352.     jsr    -132(a6)        ;forbid
  353.         
  354.     move.l    ($6c).w,intvbold
  355.     move.l    #intvb,($6c).w
  356.     move.l    ($64).w,inttbeold
  357.     move.l    #inttbe,($64).w
  358.     move.w    #$8001,$dff09a        ;tbeint aan
  359.     bsr    gracpr            ;reset copper
  360.     bsr    copbuf            ;copy copper
  361.     move.l    #cpr,$dff080
  362.  
  363.     movem.l    (sp)+,d0-d7/a0-a6
  364.     rts
  365.     
  366. cprsprrem
  367.     movem.l    d0-d7/a0-a6,-(sp)
  368.     lea    cprspr,a0
  369.     move.l    #sprdat,d0
  370.     move.w    #7,d1
  371. cprsprrem.a
  372.     move.w    d0,3*2(a0)
  373.     swap    d0
  374.     move.w    d0,1*2(a0)
  375.     swap    d0
  376.     add.l    #8,a0
  377.     dbra    d1,cprsprrem.a
  378.     movem.l    (sp)+,d0-d7/a0-a6
  379.     rts
  380.  
  381. varset                    ;variablen neerzetten
  382.     movem.l    d0-d7/a0-a6,-(sp)
  383.     move.l    #var,a0
  384.  
  385.     move.l    #cprbck,var_cprbck(a0)
  386.     move.l    gfxlib,var__GfxBase(a0)
  387.     move.b    ntscmode,var_ntsc(a0)
  388.  
  389.     move.l    curpic1,var_pic1(a0)    ;variabel
  390.     move.l    curpic2,var_pic2(a0)    ;variabel
  391.     move.w    anispd1,var_anispd1(a0)
  392.     move.w    anitel1,var_anitel1(a0)
  393.     movem.l    (sp)+,d0-d7/a0-a6
  394.     rts
  395.     
  396.     ;this routine handles all videotracker-routines
  397.  
  398. rotply    
  399.     movem.l    d0-d7/a0-a6,-(sp)
  400.  
  401.     moveq.l    #0,d0
  402.  
  403.     lea    currot1,a2        ;routine 1
  404.     move.w    rotinf1,d0        ;routine info
  405.     bsr.s    rotplyr
  406.  
  407. rotply.end
  408.     movem.l    (sp)+,d0-d7/a0-a6
  409.     rts
  410.  
  411.     ;this routine handles 1 routine, BLIT !
  412.     
  413. rotplyr
  414.     movem.l    d0-d7/a1-a6,-(sp)
  415.  
  416.     move.l    #rot,(a2)        ;routinestart address
  417.  
  418. ;    move.b    #50,ntscmode        ;ntsc/pal hz
  419.     clr.l    curpic2            ;background picture
  420.     move.w    #1,anispd1        ;animationspeed
  421.     clr.w    anitel1            ;animation position
  422.  
  423.     lea    var,a0            ;c